package matlap.client.view.admin;

import matlap.client.view.MatlapGWT;
import matlap.client.view.admin.ArticlesComposite;
import com.google.gwt.user.client.ui.Composite;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.VerticalPanel;
import com.google.gwt.user.client.ui.MenuBar;
import com.google.gwt.user.client.ui.MenuItem;
import com.google.gwt.user.client.Command;
import com.google.gwt.user.client.ui.MenuItemSeparator;

public class AdminMenuComposite extends Composite {

	private String who;
	private Panel bigPanel;
	private MatlapGWT matlap;
	private MenuItem mntmMego;
	private MenuItem mntmJavtk;
	private MenuItem mntmRend;
	private MenuItem mntmFela;
	private MenuItem mntmRl;
	private MenuItem mntmPass;
	private MenuItem mntmPont;
	private MenuItem mntmIskolak;
	private MenuItem mntmCikkek;
	private MenuItem mntmAdataim;
	private boolean clicked;
	private MenuItem mntmHirek;

	public boolean isClicked() {
		return clicked;
	}

	public AdminMenuComposite(Panel bigP, String w, MatlapGWT matlapGWT) {
		this.who = w;
		this.bigPanel = bigP;
		this.matlap = matlapGWT;
		final VerticalPanel verticalPanel = new VerticalPanel();
		initWidget(verticalPanel);
		verticalPanel.setSize("151px", "344px");

		MenuBar menuBar_1 = new MenuBar(true);
		menuBar_1.setStyleName("MenuBar2");
		verticalPanel.add(menuBar_1);
		menuBar_1.setSize("150px", "341px");
		//---------------------------------------------------------------Megoldok
		mntmMego = new MenuItem("Feladatmegoldók", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new StudentsComposite());
				clicked = true;
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("SelectedMenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmMego.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmMego);

		MenuItemSeparator separator = new MenuItemSeparator();
		separator.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator);
		separator.setSize("151px", "2px");
		//-----------------------------------------------------Feladatok
		mntmFela = new MenuItem("Feladatok", false, new Command() {
			public void execute() {
				bigPanel.clear();
				new TasksComposite(who,bigPanel);
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmFela.setStyleName("SelectedMenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmFela.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmFela);

		MenuItemSeparator separator_5 = new MenuItemSeparator();
		separator_5.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_5);
		separator_5.setSize("151px", "2px");

		//-----------------------------------------------------Pontok
		mntmPont = new MenuItem("Pontszámok", false, new Command() {
			public void execute() {
				bigPanel.clear();
				StudentsScoreComposite t = new StudentsScoreComposite();
				bigPanel.add(t);
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmPont.setStyleName("SelectedMenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmPont.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmPont);

		MenuItemSeparator separator_7 = new MenuItemSeparator();
		separator_7.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_7);
		separator_7.setSize("151px", "2px");
		//-----------------------------------------------------Iskolak
		mntmIskolak = new MenuItem("Iskol\u00E1k", false, new Command() {
			public void execute() {
				bigPanel.clear();
				SchoolsComposite t = new SchoolsComposite();
				bigPanel.add(t);
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("SelectedMenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmIskolak.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmIskolak);

		MenuItemSeparator separator_9 = new MenuItemSeparator();
		separator_9.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_9);
		separator_9.setSize("151px", "2px");


		//-----------------------------------------------------Javitok
		mntmJavtk = new MenuItem("Jav\u00EDt\u00F3k", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new TeachersComposite());
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("SelectedMenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmJavtk.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmJavtk);

		MenuItemSeparator separator_3 = new MenuItemSeparator();
		separator_3.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_3);
		separator_3.setSize("151px", "2px");

		//-----------------------------------------------------Rendelok
		mntmRend = new MenuItem("Rendelők", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new DistributorsComposite());
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("SelectedMenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmRend.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmRend);

		MenuItemSeparator separator_4 = new MenuItemSeparator();
		separator_4.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_4);
		separator_4.setSize("151px", "2px");

		//-----------------------------------------------------Rendelesek
		mntmRl = new MenuItem("Rendelések", false, new Command() {
			public void execute() {
				bigPanel.clear();
				OrdersComposite t = new OrdersComposite();
				bigPanel.add(t);
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("SelectedMenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmRl.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmRl);

		MenuItemSeparator separator_6 = new MenuItemSeparator();
		separator_6.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_6);
		separator_6.setSize("151px", "2px");
		//----------------------------------------------------------------Hirek
		mntmHirek = new MenuItem("H\u00EDrek felvezet\u00E9se", false,
				new Command() {
			public void execute() {
				bigPanel.clear();
				AdminNewsComposite ac = new AdminNewsComposite();
				bigPanel.add(ac);
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("SelectedMenuItem2");
			}
		});
		mntmHirek.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmHirek);

		MenuItemSeparator separator_10 = new MenuItemSeparator();
		separator_10.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_10);
		separator_10.setSize("151px", "2px");
		//--------------------------------------------Cikkek
		mntmCikkek = new MenuItem("Cikkek felt\u00F6lt\u00E9se", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new ArticlesComposite());
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("SelectedMenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmCikkek.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmCikkek);

		MenuItemSeparator separator_8 = new MenuItemSeparator();
		separator_8.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_8);
		separator_8.setSize("151px", "2px");
		//-----------------------------------------------------Jelszo		
		mntmPass = new MenuItem("Jelszavak", false, new Command() {
			public void execute() {
				bigPanel.clear();
				bigPanel.add(new PasswordComposite());
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPass.setStyleName("SelectedMenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("MenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmPass.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmPass);
		
		MenuItemSeparator separator_uj = new MenuItemSeparator();
		separator_uj.setStyleName("MenuItemSeparator2");
		menuBar_1.addSeparator(separator_uj);
		separator_uj.setSize("151px", "2px");

		//---------------------------------------------------------------Adataim
		mntmAdataim = new MenuItem("Adataim", false, new Command() {
			public void execute() {
				bigPanel.clear();
				AdminAccountComposite t = new AdminAccountComposite(who);
				bigPanel.add(t);
				matlap.setUnSelectedMenuItem();
				mntmMego.setStyleName("MenuItem2");
				mntmJavtk.setStyleName("MenuItem2");
				mntmRend.setStyleName("MenuItem2");
				mntmFela.setStyleName("MenuItem2");
				mntmRl.setStyleName("MenuItem2");
				mntmPass.setStyleName("MenuItem2");
				mntmPont.setStyleName("MenuItem2");
				mntmIskolak.setStyleName("MenuItem2");
				mntmCikkek.setStyleName("MenuItem2");
				mntmAdataim.setStyleName("SelectedMenuItem2");
				mntmHirek.setStyleName("MenuItem2");
			}
		});
		mntmAdataim.setStyleName("MenuItem2");
		menuBar_1.addItem(mntmAdataim);

	}

	public void setUnSelectedMenuItems() {
		mntmMego.setStyleName("MenuItem2");
		mntmJavtk.setStyleName("MenuItem2");
		mntmRend.setStyleName("MenuItem2");
		mntmFela.setStyleName("MenuItem2");
		mntmRl.setStyleName("MenuItem2");
		mntmPont.setStyleName("MenuItem2");
		mntmIskolak.setStyleName("MenuItem2");
		mntmCikkek.setStyleName("MenuItem2");
		mntmAdataim.setStyleName("MenuItem2");
		mntmHirek.setStyleName("MenuItem2");
		mntmPass.setStyleName("MenuItem2");
	}

}
